package com.jmrztht;

import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.ServletException;
import java.io.IOException;
import java.io.PrintWriter;

/**
 * To change this template use File | Settings | File Templates.
 */
public class ResultServlet extends HttpServlet {


        public void doGet(HttpServletRequest request, HttpServletResponse response)
                throws ServletException, IOException {

            doPost(request, response);
        }
        public void doPost(HttpServletRequest request, HttpServletResponse response)
                throws ServletException, IOException {

            response.setContentType("text/html;charset=utf-8");
            String validateC = (String) request.getSession().getAttribute("validateCode");
            String veryCode = request.getParameter("c");
            System.out.println(veryCode);
            System.out.println(validateC);
            PrintWriter out = response.getWriter();
            veryCode=veryCode.toUpperCase();
            if (veryCode == null || "".equals(veryCode)) {
                out.print("null");
            } else {
                if (validateC.equals(veryCode)) {
                    out.print("true");
                } else {
                    out.print("false");
                }
            }
            out.flush();
            out.close();
        }

    }

